'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const db = uniCloud.database({});
	const shop = db.collection('db_shop')
	//返回数据给客户端
	let dd = 0;
	await shop.where({
		item_id: event.item_id
	}).get().then((i) => {
		console.log(i.data[0].item_num)
		dd = i.data[0].item_num + 1
	})
	await shop.where({
		item_id: event.item_id
	}).update({
		item_num: dd
	})
	return dd
};